import Book.BookList;
import user.Admi;
import user.Normal;
import user.User;

import java.util.Scanner;

public class Main {

    public static User login(){
        //login函数实现用户登录操作
        //写代码过程中发现该函数会创建一个User类
        //此时需要修改函数的返回值为User
        Scanner p=new Scanner (System.in);
        System.out.println ("请输入你的姓名:");
        String name=p.nextLine ();
        System.out.println ("请输入你的身份: 1->管理员  2->用户 ");
        int choice=p.nextInt ();
        if(choice==1) {
            return new Admi (name);
        }else{
            return new Normal (name);
        }
    }

    public static void main (String[] args) {
        BookList list=new BookList ();
        User user=login();
        while(true){
            int choice= user.menu ();
            user.doOperation (choice,list);
        }

    }
}
